home *** CD-ROM | disk | FTP | other *** search
/ Danny Amor's Online Library / Danny Amor's Online Library - Volume 1.iso / html / faqs / faq / uucp-internals < prev    next >
Encoding:
Text File  |  1995-07-25  |  70.8 KB  |  1,594 lines

  1. Subject: UUCP Internals Frequently Asked Questions
  2. Newsgroups: comp.mail.uucp,comp.answers,news.answers
  3. From: ian@airs.com (Ian Lance Taylor)
  4. Date: 22 Nov 94 09:30:03 GMT
  5.  
  6. Archive-name: uucp-internals
  7. Version: $Revision: 1.26 $
  8. Last-modified: $Date: 1994/10/26 02:39:07 $
  9.  
  10.  This article was written by Ian Lance Taylor <ian@airs.com> and I may
  11.  even update it periodically.  Please send me mail about suggestions
  12.  or inaccuracies.
  13.  
  14.  This article describes how the various UUCP protocols work, and
  15.  discusses some other internal UUCP issues.  It does not describe how
  16.  to configure UUCP, nor how to solve UUCP connection problems, nor how
  17.  to deal with UUCP mail.  I do not know of any FAQ postings on these
  18.  topics.  There are some documents on the net describing UUCP
  19.  configuration, but I can not keep an up to date list here; try using
  20.  archie.
  21.  
  22.  If you haven't read the news.announce.newusers articles, read them.
  23.  
  24.  This article is in digest format.  Some newsreaders will be able to
  25.  break it apart into separate articles.  Please don't ask me how to do
  26.  this, though.
  27.  
  28.  This article answers the following questions.  If one of these
  29.  questions is posted to comp.mail.uucp, please send mail to the poster
  30.  referring her or him to this FAQ.  There is no reason to post a
  31.  followup, as most of us know the answer already.
  32.  
  33. Sources
  34. What does "alarm" mean in debugging output?
  35. What are UUCP grades?
  36. What is the format of a UUCP lock file?
  37. What is the format of a UUCP X.* file?
  38. What is the UUCP protocol?
  39. What is the 'g' protocol?
  40. What is the 'f' protocol?
  41. What is the 't' protocol?
  42. What is the 'e' protocol?
  43. What is the 'G' protocol?
  44. What is the 'i' protocol?
  45. What is the 'j' protocol?
  46. What is the 'x' protocol?
  47. What is the 'y' protocol?
  48. What is the 'd' protocol?
  49. What is the 'h' protocol?
  50. What is the 'v' protocol?
  51. Thanks
  52.  
  53. ----------------------------------------------------------------------
  54.  
  55. From: Sources
  56. Subject: Sources
  57.  
  58. "Unix-to-Unix Copy Program," said PDP-1.  "You will never find a more
  59. wretched hive of bugs and flamers.  We must be cautious."
  60.                                                 --DECWars
  61.  
  62. I took a lot of the information from Jamie E. Hanrahan's paper in the
  63. Fall 1990 DECUS Symposium, and from Managing UUCP and Usenet by Tim
  64. O'Reilly and Grace Todino (with contributions by several other
  65. people).  The latter includes most of the former, and is published by
  66.         O'Reilly & Associates, Inc.
  67.         103 Morris Street, Suite A
  68.         Sebastopol, CA 95472
  69. It is currently in its tenth edition.  The ISBN number is
  70. 0-937175-93-5.
  71.  
  72. Some information is originally due to a Usenet article by Chuck
  73. Wegrzyn.  The information on execution files comes partially from
  74. Peter Honeyman.  The information on the 'g' protocol comes partially
  75. from a paper by G.L. Chesson of Bell Laboratories, partially from
  76. Jamie E. Hanrahan's paper, and partially from source code by John
  77. Gilmore.  The information on the 'f' protocol comes from the source
  78. code by Piet Berteema.  The information on the 't' protocol comes from
  79. the source code by Rick Adams.  The information on the 'e' protocol
  80. comes from a Usenet article by Matthias Urlichs.  The information on
  81. the 'd' protocol comes from Jonathan Clark, who also supplied
  82. information about QFT.  The FSUUCP information comes straight from
  83. Christopher J. Ambler; it applies to version 1.4 and up.
  84.  
  85. Although there are few books about UUCP, there are many about networks
  86. and protocols in general.  I recommend two non-technical books which
  87. describe the sorts of things that are available on the network: ``The
  88. Whole Internet,'' by Ed Krol, and ``Zen and the Art of the Internet,''
  89. by Brendan P. Kehoe.  Good technical discussions of networking issues
  90. can be found in ``Internetworking with TCP/IP,'' by Douglas E. Comer
  91. and David L. Stevens and in ``Design and Validation of Computer
  92. Protocols'' by Gerard J. Holzmann.
  93.  
  94. ------------------------------
  95.  
  96. From: alarm
  97. Subject: What does "alarm" mean in debugging output?
  98.  
  99. The debugging output of many versions of UUCP (but not Taylor UUCP)
  100. will include messages like
  101.     alarm 1
  102. or
  103.     pkcget: alarm 1
  104.  
  105. This message means that the UUCP package has timed out while waiting
  106. for some sort of response from the remote system.  This normally
  107. indicates some sort of connection problem.  For example, the modems
  108. might have lost their connection, or perhaps one of the modems will
  109. not transmit the XON and XOFF characters, or perhaps one side or the
  110. other is dropping characters.  It can also mean that the packages
  111. disagree about some aspect of the UUCP protocol, although this is less
  112. common.
  113.  
  114. Using the information in the rest of this posting, you should be able
  115. to figure out what type of data your UUCP was expecting to receive.
  116. This may give some indication as to exactly what the problem is.  It
  117. is difficult to be more specific, since there are many possiblities.
  118.  
  119. ------------------------------
  120.  
  121. From: UUCP-grades
  122. Subject: What are UUCP grades?
  123.  
  124. Modern UUCP packages support grades for each command.  The grades
  125. generally range from 'A' (the highest) to 'Z' followed by 'a' to 'z'.
  126. Some UUCP packages also support '0' to '9' before 'A'.  Some UUCP
  127. packages may permit any ASCII character as a grade.
  128.  
  129. On Unix, these grades are encoded in the name of the command file.  A
  130. command file name generally has the form
  131.     C.nnnngssss
  132. where nnnn is the remote system name for which the command is queued,
  133. g is a single character grade, and ssss is a four character sequence
  134. number.  For example, a command file created for the system ``airs''
  135. at grade 'Z' might be named
  136.     C.airsZ2551
  137.  
  138. The remote system name will be truncated to seven characters, to
  139. ensure that the command file name will fit in the 14 character file
  140. name limit of the traditional Unix file system.  UUCP packages which
  141. have no other means of distinguishing which command files are intended
  142. for which systems thus require all systems they connect to to have
  143. names that are unique in the first seven characters.  Some UUCP
  144. packages use a variant of this format which truncates the system name
  145. to six characters.  HDB and Taylor UUCP use a different spool
  146. directory format, which allows up to fourteen characters to be used
  147. for each system name.
  148.  
  149. The sequence number in the command file name may be a decimal integer,
  150. or it may be a hexadecimal integer, or it may contain any alphanumeric
  151. character.  Different UUCP packages are different.
  152.  
  153. FSUUCP (a DOS based UUCP and news package) uses up to 8 characters for
  154. file names in the spool (this is a DOS file name limitation; actually,
  155. with the extension, 11 characters are available, but FSUUCP reserves
  156. that for future use).  FSUUCP defaults mail to grade D, and news to
  157. grade N, except that when the grade of incoming mail can be
  158. determined, that grade is preserved if the mail is forwarded to
  159. another system.  Mail and news are currently the only 2 types of
  160. transfers supported.  The default grades may be changed by editing
  161. the MAIL.RC file for mail, or the FSUUCP.CFG file for news.
  162.  
  163. UUPC/extended for DOS, OS/2 and Windows NT handles mail at grade 'C',
  164. news at grade 'd', and file transfers at grade 'n'.  The UUPC/extended
  165. UUCP and RMAIL commands accept grades to override the default, the
  166. others do not.
  167.  
  168. I do not know how command grades are handled in other non-Unix UUCP
  169. packages.
  170.  
  171. Modern UUCP packages allow you to restrict file transfer by grade
  172. depending on the time of day.  Typically this is done with a line in
  173. the Systems (or L.sys) file like this:
  174.     airs Any/Z,Any2305-0855 ...
  175. This allows grades 'Z' and above to be transferred at any time.  Lower
  176. grades may only be transferred at night.  I believe that this grade
  177. restriction applies to local commands as well as to remote commands,
  178. but I am not sure.  It may only apply if the UUCP package places the
  179. call, not if it is called by the remote system.
  180.  
  181. Taylor UUCP can use the ``timegrade'' and ``call-timegrade'' commands
  182. to achieve the same effect (and supports the above format when reading
  183. Systems or L.sys).
  184.  
  185. UUPC/extended provides the symmetricgrades option to announce the
  186. current grade in effect when calling the remote system.
  187.  
  188. This sort of grade restriction is most useful if you know what grades
  189. are being used at the remote site.  The default grades used depend on
  190. the UUCP package.  Generally uucp and uux have different defaults.  A
  191. particular grade can be specified with the -g option to uucp or uux.
  192. For example, to request execution of rnews on airs with grade 'd', you
  193. might use something like
  194.     uux -gd - airs!rnews <article
  195.  
  196. Uunet queues up mail at grade 'C', but increases the grade based on
  197. the size.  News is queued at grade 'd', and file transfers at grade
  198. 'n'.  The example above would allow mail (below some large size) to be
  199. received at any time, but would only permit news to be transferred at
  200. night.
  201.  
  202. ------------------------------
  203.  
  204. From: UUCP-lock-file
  205. Subject: What is the format of a UUCP lock file?
  206.  
  207. This discussion applies only to Unix.  I have no idea how UUCP locks
  208. ports on other systems.
  209.  
  210. UUCP creates files to lock serial ports and systems.  On most if not
  211. all systems these same lock files are also used by cu to coordinate
  212. access to serial ports.  On some systems getty also uses these lock
  213. files, often under the name uugetty.
  214.  
  215. The lock file normally contains the process ID of the locking process.
  216. This makes it easy to determine whether a lock is still valid.  The
  217. algorithm is to create a temporary file and then link it to the name
  218. that must be locked.  If the link fails because a file with that name
  219. already exists, the existing file is read to get the process ID.  If
  220. the process still exists, the lock attempt fails.  Otherwise the lock
  221. file is deleted and the locking algorithm is retried.
  222.  
  223. Older UUCP packages put the lock files in the main UUCP spool
  224. directory, /usr/spool/uucp.  HDB UUCP generally puts the lock files in
  225. a directory of their own, usually /usr/spool/locks or /etc/locks.
  226.  
  227. The original UUCP lock file format encodes the process ID as a four
  228. byte binary number.  The order of the bytes is host-dependent.  HDB
  229. UUCP stores the process ID as a ten byte ASCII decimal number, with a
  230. trailing newline.  For example, if process 1570 holds a lock file, it
  231. would contain the eleven characters space, space, space, space, space,
  232. space, one, five, seven, zero, newline.  Some versions of UUCP add a
  233. second line indicating which program created the lock (uucp, cu, or
  234. getty/uugetty).  I have also seen a third type of UUCP lock file which
  235. does not contain the process ID at all.
  236.  
  237. The name of the lock file is traditionally "LCK.." followed by the
  238. base name of the device.  For example, to lock /dev/ttyd0 the file
  239. LCK..ttyd0 would be created.  On SCO Unix, the lock file name is
  240. always forced to lower case even if the device name has upper case
  241. letters.
  242.  
  243. System V Release 4 UUCP names the lock file using the major and minor
  244. device numbers rather than the device name.  The file is named
  245. LK.XXX.YYY.ZZZ, where XXX, YYY and ZZZ are all three digit decimal
  246. numbers.  XXX is the major device number of the device holding the
  247. directory holding the device file (e.g., /dev).  YYY is the major
  248. device number of the device file itself.  ZZZ is the minor device
  249. number of the device file itself.  If s holds the result of passing
  250. the device to the stat system call (e.g., stat ("/dev/ttyd0", &s)),
  251. the following line of C code will print out the corresponding lock
  252. file name:
  253.     printf ("LK.%03d.%03d.%03d", major (s.st_dev),
  254.             major (s.st_rdev), minor (s.st_rdev));
  255. The advantage of this system is that even if there are several links
  256. to the same device, they will all use the same lock file name.
  257.  
  258. ------------------------------
  259.  
  260. From: X-file
  261. Subject: What is the format of a UUCP X.* file?
  262.  
  263. UUCP X.* files control program execution.  They are created by uux.
  264. They are transferred between computers just like any other file.  The
  265. uuxqt daemon reads them to figure out how to execute the job requested
  266. by uux.
  267.  
  268. An X.* file is simply a text file.  The first character of each line
  269. is a command, and the remainder of the line supplies arguments.  The
  270. following commands are defined:
  271.     C command
  272.         This gives the command to execute, including the program and
  273.         all arguments.  For example,
  274.             C rmail ian@airs.com
  275.     U user system
  276.         This names the user who requested the command, and the system
  277.         from which the request came.
  278.     I standard-input
  279.         This names the file from which standard input is taken.  If no
  280.         standard input file is given, the standard input will probably
  281.         be attached to /dev/null.  If the standard input file is not
  282.         from the system on which the execution is to occur, it will
  283.         also appear in an F command.
  284.     O standard-output [ system ]
  285.         This names the standard output file.  The optional second
  286.         argument names the system to which the file should be sent.
  287.         If there is no second argument, the file should be created on
  288.         the executing system.
  289.     F required-file [ filename-to-use ]
  290.         The F command can appear multiple times.  Each F command names
  291.         a file which must exist before the execution can proceed.
  292.         This will usually be a file which is transferred from the
  293.         system on which uux was executed, but it can also be a file
  294.         from the local system or some other system.  If the file is
  295.         not from the local system, then the command will usually name
  296.         a file in the spool directory.  If the optional second
  297.         argument appears, then the file should be copied to the
  298.         execution directory under that name.  This is necessary for
  299.         any file other than the standard input file.  If the standard
  300.         input file is not from the local system, it will appear in
  301.         both an F command and an I command.
  302.     R requestor-address
  303.         This is the address to which mail about the job should be
  304.         sent.  It is relative to the system named in the U command.
  305.         If the R command does not appear, then mail is sent to the
  306.         user named in the U command.
  307.     Z
  308.         This command takes no arguments.  It means that a mail message
  309.         should be sent if the command failed.  This is the default
  310.         behaviour for most modern UUCP packages, and for them the Z
  311.         command does not actually do anything.
  312.     N
  313.         This command takes no arguments.  It means that no mail
  314.         message should be sent, even if the command failed.
  315.     n
  316.         This command takes no arguments.  It means that a mail message
  317.         should be sent if the command succeeded.  Normally a message
  318.         is sent only if the command failed.
  319.     B
  320.         This command takes no arguments.  It means that the standard
  321.         input should be returned with any error message.  This can be
  322.         useful in cases where the input would otherwise be lost.
  323.     e
  324.         This command takes no arguments.  It means that the command
  325.         should be processed with /bin/sh.  For some packages this is
  326.         the default anyhow.  Most packages will refuse to execute
  327.         complex commands or commands containing wildcards, because of
  328.         the security holes this opens.
  329.     E
  330.         This command takes no arguments.  It means that the command
  331.         should be processed with the execve system call.  For some
  332.         packages this is the default anyhow.
  333.     M status-file
  334.         This command means that instead of mailing a message, the
  335.         message should be copied to the named file on the system named
  336.         by the U command.
  337.     # comment
  338.         This command is ignored, as is any other unrecognized command.  
  339.  
  340. Here is an example.  Given the following command executed on system
  341. test1
  342.     uux - test2!cat - test2!~ian/bar !qux '>~/gorp'
  343. (this is only an example, as most UUCP systems will not permit the cat
  344. command to be executed) Taylor UUCP will produce the following X.
  345. file:
  346.     U ian test1
  347.     F D.test1N003r qux
  348.     O /usr/spool/uucppublic test1
  349.     F D.test1N003s
  350.     I D.test1N003s
  351.     C cat - ~ian/bar qux
  352. The standard input will be read into a file and then transferred to
  353. the file D.test1N003s on system test2, and the file qux will be
  354. transferred to D.test1N003r on system test2.  When the command is
  355. executed, the latter file will be copied to the execution directory
  356. under the name qux.  Note that since the file ~ian/bar is already on
  357. the execution system, no action need be taken for it.  The standard
  358. output will be collected in a file, then copied to the directory
  359. /usr/spool/uucppublic on the system test1.
  360.  
  361. ------------------------------
  362.  
  363. From: UUCP-protocol
  364. Subject: What is the UUCP protocol?
  365.  
  366. The UUCP protocol is a conversation between two UUCP packages.  A UUCP
  367. conversation consists of three parts: an initial handshake, a series
  368. of file transfer requests, and a final handshake.
  369.  
  370. Before the initial handshake, the caller will usually have logged in
  371. the called machine and somehow started the UUCP package there.  On
  372. Unix this is normally done by setting the shell of the login name used
  373. to /usr/lib/uucp/uucico.
  374.  
  375. All messages in the initial handshake begin with a ^P (a byte with the
  376. octal value \020) and end with a null byte (\000).  A few systems end
  377. these messages with a line feed character (\012) instead of a null
  378. byte; the examples below assume a null byte is being used.
  379.  
  380. Some options below are supported by QFT, which stands for Queued File
  381. Transfer, and is (or was) an internal Bell Labs version of UUCP.  
  382.  
  383. Taylor UUCP size negotiation was introduced by Taylor UUCP, and is
  384. also supported by DOS based FSUUCP and Amiga based wUUCP and
  385. UUCP-1.17.
  386.  
  387. The initial handshake goes as follows.  It is begun by the called
  388. machine.
  389.  
  390. called: \020Shere=hostname\000
  391.     The hostname is the UUCP name of the called machine.  Older UUCP
  392.     packages do not output it, and simply send \020Shere\000.
  393.  
  394. caller: \020Shostname options\000
  395.     The hostname is the UUCP name of the calling machine.  The
  396.     following options may appear (or there may be none):
  397.         -QSEQ
  398.             Report sequence number for this conversation.  The
  399.             sequence number is stored at both sites, and incremented
  400.             after each call.  If there is a sequence number mismatch,
  401.             something has gone wrong (somebody may have broken
  402.             security by pretending to be one of the machines) and the
  403.             call is denied.  If the sequence number changes on one of
  404.             the machines, perhaps because of an attempted breakin or
  405.             because a disk backup was restored, the sequence numbers
  406.             on the two machines must be reconciled manually.  This is
  407.             not supported by FSUUCP.
  408.         -xLEVEL
  409.             Requests the called system to set its debugging level to
  410.             the specified value.  This is not supported by all
  411.             systems.
  412.         -pGRADE
  413.         -vgrade=GRADE
  414.             Requests the called system to only transfer files of the
  415.             specified grade or higher.  This is not supported by all
  416.             systems.  Some systems support -p, some support -vgrade=.
  417.         -R
  418.             Indicates that the calling UUCP understands how to restart
  419.             failed file transmissions.  Supported only by System V
  420.             Release 4 UUCP and QFT.
  421.         -ULIMIT
  422.             Reports the ulimit value of the calling UUCP.  The limit
  423.             is specified as a base 16 number in C notation (e.g.,
  424.             -U0x1000000).  This number is the number of 512 byte
  425.             blocks in the largest file which the calling UUCP can
  426.             create.  The called UUCP may not transfer a file larger
  427.             than this.  Supported only by System V Release 4 UUCP, QFT
  428.             and FSUUCP.  FSUUCP reports the lesser of the
  429.             available disk space on the spool directory drive and the
  430.             ulimit variable in FSUUCP.CFG.
  431.         -N
  432.             Indicates that the calling UUCP understands the Taylor
  433.             UUCP size negotiation extension.  Not supported by
  434.         traditional UUCP packages.
  435.  
  436. called: \020ROK\000
  437.     There are actually several possible responses.
  438.         ROK
  439.             The calling UUCP is acceptable, and the handshake proceeds
  440.             to the protocol negotiation.  Some options may also
  441.             appear; see below.
  442.         ROKN
  443.             The calling UUCP is acceptable, it specified -N, and the
  444.             called UUCP also understands the Taylor UUCP size limiting
  445.             extensions.
  446.         RLCK
  447.             The called UUCP already has a lock for the calling UUCP,
  448.             which normally indicates the two machines are already
  449.             communicating.
  450.         RCB
  451.             The called UUCP will call back.  This may be used to avoid
  452.             impostors (but only one machine out of each pair should
  453.             call back, or no conversation will ever begin).
  454.         RBADSEQ
  455.             The call sequence number is wrong (see the -Q discussion
  456.             above). 
  457.         RLOGIN
  458.             The calling UUCP is using the wrong login name.
  459.         RYou are unknown to me
  460.             The calling UUCP is not known to the called UUCP, and the
  461.             called UUCP does not permit connections from unknown
  462.             systems.  Some versions of UUCP just drop the line rather
  463.             than sending this message.
  464.  
  465.     If the response is ROK, the following options are supported by
  466.     System V Release 4 UUCP and QFT.
  467.         -R
  468.             The called UUCP knows how to restart failed file
  469.             transmissions.
  470.         -ULIMIT
  471.             Reports the ulimit value of the called UUCP.  The limit is
  472.             specified as a base 16 number in C notation.  This number
  473.             is the number of 512 byte blocks in the largest file which
  474.             the called UUCP can create.  The calling UUCP may not send
  475.             a file larger than this.  Also supported by FSUUCP.
  476.         -xLEVEL
  477.             I'm not sure just what this means.  It may request the
  478.             calling UUCP to set its debugging level to the specified
  479.             value.
  480.     If the response is not ROK (or ROKN) both sides hang up the phone,
  481.     abandoning the call.
  482.  
  483. called: \020Pprotocols\000
  484.     Note that the called UUCP outputs two strings in a row.  The
  485.     protocols string is a list of UUCP protocols supported by the
  486.     caller.  Each UUCP protocol has a single character name.  These
  487.     protocols are discussed in more detail later in this document.
  488.     For example, the called UUCP might send \020Pgf\000.
  489.  
  490. caller: \020Uprotocol\000
  491.     The calling UUCP selects which protocol to use out of the
  492.     protocols offered by the called UUCP.  If there are no mutually
  493.     supported protocols, the calling UUCP sends \020UN\000 and both
  494.     sides hang up the phone.  Otherwise the calling UUCP sends
  495.     something like \020Ug\000.
  496.  
  497. Most UUCP packages will consider each locally supported protocol in
  498. turn and select the first one supported by the called UUCP.  With some
  499. versions of HDB UUCP, this can be modified by giving a list of
  500. protocols after the device name in the Devices file or the Systems
  501. file.  For example, to select the 'e' protocol in Systems,
  502.     airs Any ACU,e ...
  503. or in Devices,
  504.     ACU,e ttyXX ...
  505. Taylor UUCP provides the ``protocol'' command which may be used either
  506. for a system or a port.
  507.  
  508. After the protocol has been selected and the initial handshake has been
  509. completed, both sides turn on the selected protocol.  For some
  510. protocols (notably 'g') a further handshake is done at this point.
  511.  
  512. Each protocol supports a method for sending a command to the remote
  513. system.  This method is used to transmit a series of commands between
  514. the two UUCP packages.  At all times, one package is the master and
  515. the other is the slave.  Initially, the calling UUCP is the master.
  516.  
  517. If a protocol error occurs during the exchange of commands, both sides
  518. move immediately to the final handshake.
  519.  
  520. The master will send one of four commands: S, R, X or H.
  521.  
  522. Any file name referred to below is either an absolute pathname
  523. beginning with "/", a public directory pathname beginning with "~/", a
  524. pathname relative to a user's home directory beginning with "~USER/",
  525. or a spool directory file name.  File names in the spool directory are
  526. not pathnames, but instead are converted to pathnames within the spool
  527. directory by UUCP.  They always begin with "C." (for a command file
  528. created by uucp or uux), "D." (for a data file created by uucp, uux or
  529. by an execution, or received from another system for an execution), or
  530. "X." (for an execution file created by uux or received from another
  531. system).
  532.  
  533. master: S FROM TO USER -OPTIONS TEMP MODE NOTIFY SIZE
  534.     The S and the - are literal characters.  This is a request by the
  535.     master to send a file to the slave.
  536.         FROM
  537.             The name of the file to send.  If the C option does not
  538.             appear in OPTIONS, the master will actually open and send
  539.             this file.  Otherwise the file has been copied to the
  540.             spool directory, where it is named TEMP.  The slave
  541.             ignores this field unless TO is a directory, in which case
  542.             the basename of FROM will be used as the file name.  If
  543.             FROM is a spool directory filename, it must be a data file
  544.             created for or by an execution, and must begin with "D.".
  545.         TO
  546.             The name to give the file on the slave.  If this field
  547.             names a directory the file is placed within that directory
  548.             with the basename of FROM.  A name ending in `/' is taken
  549.             to be a directory even if one does not already exist with
  550.             that name.  If TO begins with `X.', an execution file will
  551.             be created on the slave.  Otherwise, if TO begins with
  552.             `D.' it names a data file to be used by some execution
  553.             file.  Otherwise, TO should not be in the spool directory.
  554.         USER
  555.             The name of the user who requested the transfer.
  556.         OPTIONS
  557.             A list of options to control the transfer.  The following
  558.             options are defined (all options are single characters):
  559.                 C
  560.                     The file has been copied to the spool directory
  561.                     (the master should use TEMP rather than FROM).
  562.                 c
  563.                     The file has not been copied to the spool
  564.                     directory (this is the default).
  565.                 d
  566.                     The slave should create directories as necessary
  567.                     (this is the default).
  568.                 f
  569.                     The slave should not create directories if
  570.                     necessary, but should fail the transfer instead.
  571.                 m
  572.                     The master should send mail to USER when the
  573.                     transfer is complete (not supported by FSUUCP).
  574.                 n
  575.                     The slave should send mail to NOTIFY when the
  576.                     transfer is complete (not supported by FSUUCP).
  577.         TEMP
  578.             If the C option appears in OPTIONS, this names the file to
  579.             be sent.  Otherwise if FROM is in the spool directory,
  580.             TEMP is the same as FROM.  Otherwise TEMP may be a dummy
  581.             string, such as "D.0".  After the transfer has been
  582.             succesfully completed, the master will delete the file
  583.             TEMP.
  584.         MODE
  585.             This is an octal number giving the mode of the file on
  586.             MASTER.  If the file is not in the spool directory, the
  587.             slave will always create it with mode 0666, except that if
  588.             (MODE & 0111) is not zero (the file is executable), the
  589.             slave will create the file with mode 0777.  If the file is
  590.             in the spool directory, some UUCP packages will use the
  591.             algorithm above and some will always create the file with
  592.             mode 0600.  This field is not used by FSUUCP, since it is
  593.             meaningless on DOS.
  594.         NOTIFY
  595.             This field may not be present, and in any case is only
  596.             meaningful if the n option appears in OPTIONS.  If the n
  597.             option appears, then when the transfer is successfully
  598.             completed, the slave will send mail to NOTIFY, which must
  599.             be a legal mailing address on the slave.  If a SIZE field
  600.             will appear but the n option does not appear, NOTIFY will
  601.             always be present, typically as the string "dummy" or
  602.             simply a pair of double quotes.
  603.         SIZE
  604.             This field is only present when doing Taylor UUCP or SVR4
  605.             UUCP size negotiation, It is the size of the file in
  606.             bytes.  Taylor UUCP version 1.03 sends the size as a
  607.             decimal integer, while versions 1.04 and up, and all other
  608.             UUCP packages that support size negotiation, send the size
  609.             in base 16 with a leading 0x.
  610.  
  611.     The slave then responds with an S command response.
  612.         SY START
  613.             The slave is willing to accept the file, and file transfer
  614.             begins.  The START field will only be present when using
  615.             file restart.  It specifies the byte offset into the file
  616.             at which to start sending.  If this is a new file, START
  617.             will be 0x0.
  618.         SN2
  619.             The slave denies permission to transfer the file.  This
  620.             can mean that the destination directory may not be
  621.             accessed, or that no requests are permitted.  It implies
  622.             that the file transfer will never succeed.
  623.         SN4
  624.             The slave is unable to create the necessary temporary
  625.             file.  This implies that the file transfer might succeed
  626.             later.
  627.         SN6
  628.             This is only used by Taylor UUCP size negotiation.  It
  629.             means that the slave considers the file too large to
  630.             transfer at the moment, but it may be possible to transfer
  631.             it at some other time.
  632.         SN7
  633.             This is only used by Taylor UUCP size negotiation.  It
  634.             means that the slave considers the file too large to ever
  635.             transfer.
  636.         SN8
  637.             This is only used by Taylor UUCP.  It means that the file
  638.             was already received in a previous conversation.  This can
  639.             happen if the receive acknowledgement was lost after it
  640.             was sent by the receiver but before it was received by the
  641.             sender.
  642.     SN9
  643.         This is only used by Taylor UUCP (versions 1.05 and up)
  644.         and FSUUCP (versions 1.5 and up).  It means that the
  645.         remote system was unable to open another channel (see the
  646.         discussion of the 'i' protocol for more information about
  647.         channels).  This implies that the file transfer might
  648.         succeed later.
  649.         SN10
  650.             This is reportedly used by SVR4 UUCP to mean that the file
  651.             size is too large.
  652.  
  653.     If the slave responds with SY, a file transfer begins.  When the
  654.     file transfer is complete, the slave sends a C command response.
  655.         CY
  656.             The file transfer was successful.
  657.         CYM
  658.             The file transfer was successful, and the slave wishes to
  659.             become the master; the master should send an H command,
  660.             described below.
  661.         CN5
  662.             The temporary file could not be moved into the final
  663.             location.  This implies that the file transfer will never
  664.             succeed.
  665.  
  666.     After the C command response has been received (in the SY case) or
  667.     immediately (in an SN case) the master will send another command.
  668.  
  669. master: R FROM TO USER -OPTIONS SIZE
  670.     The R and the - are literal characters.  This is a request by the
  671.     master to receive a file from the slave.  I do not know how SVR4
  672.     UUCP or QFT implement file transfer restart in this case.
  673.         FROM
  674.             This is the name of the file on the slave which the master
  675.             wishes to receive.  It must not be in the spool directory,
  676.             and it may not contain any wildcards.
  677.         TO
  678.             This is the name of the file to create on the master.  I
  679.             do not believe that it can be a directory.  It may only be
  680.             in the spool directory if this file is being requested to
  681.             support an execution either on the master or on some
  682.             system other than the slave.
  683.         USER
  684.             The name of the user who requested the transfer.
  685.         OPTIONS
  686.             A list of options to control the transfer.  The following
  687.             options are defined (all options are single characters):
  688.                 d
  689.                     The master should create directories as necessary
  690.                     (this is the default).
  691.                 f
  692.                     The master should not create directories if
  693.                     necessary, but should fail the transfer instead.
  694.                 m
  695.                     The master should send mail to USER when the
  696.                     transfer is complete.
  697.         SIZE
  698.             This only appears if Taylor UUCP size negotiation is being
  699.             used.  It specifies the largest file which the master is
  700.             prepared to accept (when using SVR4 UUCP or QFT, this was
  701.             specified in the -U option during the initial handshake).
  702.  
  703.     The slave then responds with an R command response.  FSUUCP does
  704.     not support R requests, and always responds with RN2.
  705.         RY MODE [ SIZE ]
  706.             The slave is willing to send the file, and file transfer
  707.             begins.  MODE is the octal mode of the file on the slave.
  708.             The master treats this just as the slave does the MODE
  709.             argument in the send command, q.v.  I am told that SVR4
  710.             UUCP sends a trailing SIZE argument.  For some versions of
  711.             BSD UUCP, the MODE argument may have a trailing M
  712.             character (e.g., RY 0666M).  This means that the slave
  713.             wishes to become the master.
  714.         RN2
  715.             The slave is not willing to send the file, either because
  716.             it is not permitted or because the file does not exist.
  717.             This implies that the file request will never succeed.
  718.         RN6
  719.             This is only used by Taylor UUCP size negotiation.  It
  720.             means that the file is too large to send, either because
  721.             of the size limit specifies by the master or because the
  722.             slave considers it too large.  The file transfer might
  723.             succeed later, or it might not (this will be cleared up in
  724.             a later release of Taylor UUCP).
  725.     RN9
  726.         This is only used by Taylor UUCP (versions 1.05 and up)
  727.         and FSUUCP (versions 1.5 and up).  It means that the
  728.         remote system was unable to open another channel (see the
  729.         discussion of the 'i' protocol for more information about
  730.         channels).  This implies that the file transfer might
  731.         succeed later.
  732.  
  733.     If the slave responds with RY, a file transfer begins.  When the
  734.     file transfer is complete, the master sends a C command.  The
  735.     slave pretty much ignores this, although it may log it.
  736.         CY
  737.             The file transfer was successful.
  738.         CN5
  739.             The temporary file could not be moved into the final
  740.             location.
  741.  
  742.     After the C command response has been sent (in the RY case) or
  743.     immediately (in an RN case) the master will send another command.
  744.  
  745. master: X FROM TO USER -OPTIONS
  746.     The X and the - are literal characters.  This is a request by the
  747.     master to, in essence, execute uucp on the slave.  The slave
  748.     should execute "uucp FROM TO".
  749.         FROM
  750.             This is the name of the file or files on the slave which
  751.             the master wishes to transfer.  Any wildcards are expanded
  752.             on the slave.  If the master is requesting that the files
  753.             be transferred to itself, the request would normally
  754.             contain wildcard characters, since otherwise an `R'
  755.             command would suffice.  The master can also use this
  756.             command to request that the slave transfer files to a
  757.             third system.
  758.         TO
  759.             This is the name of the file or directory to which the
  760.             files should be transferred.  This will normally use a
  761.             UUCP name.  For example, if the master wishes to receive
  762.             the files itself, it would use "master!path".
  763.         USER
  764.             The name of the user who requested the transfer.
  765.         OPTIONS
  766.             A list of options to control the transfer.  It is not
  767.             clear which, if any, options are supported by most UUCP
  768.             packages.
  769.  
  770.     The slave then responds with an X command response.  FSUUCP does
  771.     not support X requests, and always responds with XN.
  772.         XY
  773.             The request was accepted, and the appropriate file
  774.             transfer commands have been queued up for later
  775.             processing.
  776.         XN
  777.             The request was denied.  No particular reason is given.
  778.  
  779.     In either case, the master will then send another command.
  780.  
  781. master: H
  782.     This is used by the master to hang up the connection.  The slave
  783.     will respond with an H command response.
  784.         HY
  785.             The slave agrees to hang up the connection.  In this case
  786.             the master sends another HY command.  In some UUCP
  787.             packages the slave will then send a third HY command.  At
  788.             this point the protocol is shut down, and the final
  789.             handshake is begun.
  790.         HN
  791.             The slave does not agree to hang up.  In this case the
  792.             master and the slave exchange roles.  The next command
  793.             will be sent by the former slave, which is the new master.
  794.             The roles may be reversed several times during a single
  795.             connection.
  796.  
  797. After the protocol has been shut down, the final handshake is
  798. performed.  This handshake has no real purpose, and some UUCP packages
  799. simply drop the connection rather than do it (in fact, some will drop
  800. the connection immediately after both sides agree to hangup, without
  801. even closing down the protocol).
  802.  
  803. caller: \020OOOOOO\000
  804. called: \020OOOOOOO\000
  805.  
  806. That is, the calling UUCP sends six O's and the called UUCP replies
  807. with seven O's.  Some UUCP packages always send six O's.
  808.  
  809. ------------------------------
  810.  
  811. From: UUCP-g
  812. Subject: What is the 'g' protocol?
  813.  
  814. The 'g' protocol is a packet based flow controlled error correcting
  815. protocol that requires an eight bit clear connection.  It is the
  816. original UUCP protocol, and is supported by all UUCP implementations.
  817. Many implementations of it are only able to support small window and
  818. packet sizes, specifically a window size of 3 and a packet size of 64
  819. bytes, but the protocol itself can support up to a window size of 7
  820. and a packet size of 4096 bytes.  Complaints about the inefficiency of
  821. the 'g' protocol generally refer to specific implementations, rather
  822. than to the correctly implemented protocol.
  823.  
  824. The 'g' protocol was originally designed for general packet drivers,
  825. and thus contains some features that are not used by UUCP, including
  826. an alternate data channel and the ability to renegotiate packet and
  827. window sizes during the communication session.
  828.  
  829. The 'g' protocol is spoofed by many Telebit modems.  When spoofing is
  830. in effect, each Telebit modem uses the 'g' protocol to communicate
  831. with the attached computer, but the data between the modems is sent
  832. using a Telebit proprietary error correcting protocol.  This allows
  833. for very high throughput over the Telebit connection, which, because
  834. it is half-duplex, would not normally be able to handle the 'g'
  835. protocol very well at all.  When a Telebit is spoofing the 'g'
  836. protocol, it forces the packet size to be 64 bytes and the window size
  837. to be 3.
  838.  
  839. This discussion of the 'g' protocol explains how it works, but does
  840. not discuss useful error handling techniques.  Some discussion of this
  841. can be found in Jamie E. Hanrahan's paper, cited above.
  842.  
  843. All 'g' protocol communication is done with packets.  Each packet
  844. begins with a six byte header.  Control packets consist only of the
  845. header.  Data packets contain additional data.
  846.  
  847. The header is as follows:
  848.  
  849.     \020
  850.         Every packet begins with a ^P.
  851.     k (1 <= k <= 9)
  852.         The k value is always 9 for a control packet.  For a data
  853.         packet, the k value indicates how much data follows the six
  854.         byte header.  The amount of data is 2 ** (k + 4), where **
  855.         indicates exponentiation.  Thus a k value of 1 means 32 data
  856.         bytes and a k value of 8 means 4096 data bytes.  The k value
  857.         for a data packet must be between 1 and 8 inclusive.
  858.     checksum low byte
  859.     checksum high byte
  860.         The checksum value is described below.
  861.     control byte
  862.         The control byte indicates the type of packet, and is
  863.         described below.
  864.     xor byte
  865.         This byte is the xor of k, the checksum low byte, the checksum
  866.         high byte and the control byte (i.e., the second, third,
  867.         fourth and fifth header bytes).  It is used to ensure that the
  868.         header data is valid.
  869.  
  870. The control byte in the header is composed of three bit fields,
  871. referred to here as TT (two bits), XXX (three bits) and YYY (three
  872. bits).  The control is TTXXXYYY, or (TT << 6) + (XXX << 3) + YYY.
  873.  
  874. The TT field takes on the following values:
  875.     0
  876.         This is a control packet.  In this case the k byte in the
  877.         header must be 9.  The XXX field indicates the type of control
  878.         packet; these types are described below.
  879.     1
  880.         This is an alternate data channel packet.  This is not used by
  881.         UUCP.
  882.     2
  883.         This is a data packet, and the entire contents of the attached
  884.         data field (whose length is given by the k byte in the header)
  885.         are valid.  The XXX and YYY fields are described below.
  886.     3
  887.         This is a short data packet.  Let the length of the data field
  888.         (as given by the k byte in the header) be L.  Let the first
  889.         byte in the data field be B1.  If B1 is less than 128 (if the
  890.         most significant bit of B1 is 0), then there are L - B1 valid
  891.         bytes of data in the data field, beginning with the second
  892.         byte.  If B1 >= 128, let B2 be the second byte in the data
  893.         field.  Then there are L - ((B1 & 0x7f) + (B2 << 7)) valid
  894.         bytes of data in the data field, beginning with the third
  895.         byte.  In all cases L bytes of data are sent (and all data
  896.         bytes participate in the checksum calculation) but some of the
  897.         trailing bytes may be dropped by the receiver.   The XXX and
  898.         YYY fields are described below.
  899.  
  900. In a data packet (short or not) the XXX field gives the sequence
  901. number of the packet.  Thus sequence numbers can range from 0 to 7,
  902. inclusive.  The YYY field gives the sequence number of the last
  903. correctly received packet.
  904.  
  905. Each communication direction uses a window which indicates how many
  906. unacknowledged packets may be transmitted before waiting for an
  907. acknowledgement.  The window may range from 1 to 7, and may be
  908. different in each direction. For example, if the window is 3 and the
  909. last packet acknowledged was packet number 6, packet numbers 7, 0 and
  910. 1 may be sent but the sender must wait for an acknowledgement before
  911. sending packet number 2.  This acknowledgement could come as the YYY
  912. field of a data packet or as the YYY field of a RJ or RR control
  913. packet (described below).
  914.  
  915. Each packet must be transmitted in order (the sender may not skip
  916. sequence numbers).  Each packet must be acknowledged, and each packet
  917. must be acknowledged in order.
  918.  
  919. In a control packet, the XXX field takes on the following values:
  920.     1 CLOSE
  921.         The connection should be closed immediately.  This is
  922.         typically sent when one side has seen too many errors and
  923.         wants to give up.  It is also sent when shutting down the
  924.         protocol.  If an unexpected CLOSE packet is received, a CLOSE
  925.         packet should be sent in reply and the 'g' protocol should
  926.         halt, causing UUCP to enter the final handshake.
  927.     2 RJ or NAK
  928.         The last packet was not received correctly.  The YYY field
  929.         contains the sequence number of the last correctly received
  930.         packet.
  931.     3 SRJ
  932.         Selective reject.  The YYY field contains the sequence number
  933.         of a packet that was not received correctly, and should be
  934.         retransmitted.  This is not used by UUCP, and most
  935.         implementations will not recognize it.
  936.     4 RR or ACK
  937.         Packet acknowledgement.  The YYY field contains the sequence
  938.         number of the last correctly received packet.
  939.     5 INITC
  940.         Third initialization packet.  The YYY field contains the
  941.         maximum window size to use.
  942.     6 INITB
  943.         Second initialization packet.  The YYY field contains the
  944.         packet size to use.  It requests a size of 2 ** (YYY + 5).
  945.         Note that this is not the same coding used for the k byte in
  946.         the packet header (it is 1 less).  Most UUCP implementations
  947.         that request a packet size larger than 64 bytes can handle any
  948.         packet size up to that specified.
  949.     7 INITA
  950.         First initialization packet.  The YYY field contains the
  951.         maximum window size to use.
  952.  
  953. The checksum of a control packet is simply 0xaaaa - the control byte.
  954.  
  955. The checksum of a data packet is 0xaaaa - (CHECK ^ the control byte),
  956. where ^ denotes exclusive or, and CHECK is the result of the following
  957. routine as run on the contents of the data field (every byte in the
  958. data field participates in the checksum, even for a short data
  959. packet).  Below is the routine used by Taylor UUCP; it is a slightly
  960. modified version of a routine which John Gilmore patched from G.L.
  961. Chesson's original paper.  The z argument points to the data and the c
  962. argument indicates how much data there is.
  963.  
  964. int
  965. igchecksum (z, c)
  966.      register const char *z;
  967.      register int c;
  968. {
  969.   register unsigned int ichk1, ichk2;
  970.  
  971.   ichk1 = 0xffff;
  972.   ichk2 = 0;
  973.  
  974.   do
  975.     {
  976.       register unsigned int b;
  977.  
  978.       /* Rotate ichk1 left.  */
  979.       if ((ichk1 & 0x8000) == 0)
  980.         ichk1 <<= 1;
  981.       else
  982.         {
  983.           ichk1 <<= 1;
  984.           ++ichk1;
  985.         }
  986.  
  987.       /* Add the next character to ichk1.  */
  988.       b = *z++ & 0xff;
  989.       ichk1 += b;
  990.  
  991.       /* Add ichk1 xor the character position in the buffer counting from
  992.          the back to ichk2.  */
  993.       ichk2 += ichk1 ^ c;
  994.  
  995.       /* If the character was zero, or adding it to ichk1 caused an
  996.          overflow, xor ichk2 to ichk1.  */
  997.       if (b == 0 || (ichk1 & 0xffff) < b)
  998.         ichk1 ^= ichk2;
  999.     }
  1000.   while (--c > 0);
  1001.  
  1002.   return ichk1 & 0xffff;
  1003. }
  1004.  
  1005. When the 'g' protocol is started, the calling UUCP sends an INITA
  1006. control packet with the window size it wishes the called UUCP to use.
  1007. The called UUCP responds with an INITA packet with the window size it
  1008. wishes the calling UUCP to use.  Pairs of INITB and INITC packets are
  1009. then similarly exchanged.  When these exchanges are completed, the
  1010. protocol is considered to have been started.
  1011.  
  1012. Note that the window and packet sizes are not a negotiation.  Each
  1013. system announces the window and packet size which the other system
  1014. should use.  It is possible that different window and packet sizes
  1015. will be used in each direction.  The protocol works this way on the
  1016. theory that each system knows how much data it can accept without
  1017. getting overrun.  Therefore, each system tells the other how much data
  1018. to send before waiting for an acknowledgement.
  1019.  
  1020. When a UUCP package transmits a command, it sends one or more data
  1021. packets.  All the data packets will normally be complete, although
  1022. some UUCP packages may send the last one as a short packet.  The
  1023. command string is sent with a trailing null byte, to let the receiving
  1024. package know when the command is finished.  Some UUCP packages require
  1025. the last byte of the last packet sent to be null, even if the command
  1026. ends earlier in the packet.  Some packages may require all the
  1027. trailing bytes in the last packet to be null, but I have not confirmed
  1028. this.
  1029.  
  1030. When a UUCP package sends a file, it will send a sequence of data
  1031. packets.  The end of the file is signalled by a short data packet
  1032. containing zero valid bytes (it will normally be preceeded by a short
  1033. data packet containing the last few bytes in the file).
  1034.  
  1035. Note that the sequence numbers cover the entire communication session,
  1036. including both command and file data.
  1037.  
  1038. When the protocol is shut down, each UUCP package sends a CLOSE
  1039. control packet.
  1040.  
  1041. ------------------------------
  1042.  
  1043. From: UUCP-f
  1044. Subject: What is the 'f' protocol?
  1045.  
  1046. The 'f' protocol is a seven bit protocol which checksums an entire
  1047. file at a time.  It only uses the characters between \040 and \176
  1048. (ASCII space and ~) inclusive as well as the carriage return
  1049. character.  It can be very efficient for transferring text only data,
  1050. but it is very inefficient at transferring eight bit data (such as
  1051. compressed news).  It is not flow controlled, and the checksum is
  1052. fairly insecure over large files, so using it over a serial connection
  1053. requires handshaking (XON/XOFF can be used) and error correcting
  1054. modems.  Some people think it should not be used even under those
  1055. circumstances.
  1056.  
  1057. I believe the 'f' protocol originated in BSD versions of UUCP.  It was
  1058. originally intended for transmission over X.25 PAD links.
  1059.  
  1060. The 'f' protocol has no startup or finish protocol.  However, both
  1061. sides typically sleep for a couple of seconds before starting up,
  1062. because they switch the terminal into XON/XOFF mode and want to allow
  1063. the changes to settle before beginning transmission.
  1064.  
  1065. When a UUCP package transmits a command, it simply sends a string
  1066. terminated by a carriage return.
  1067.  
  1068. When a UUCP package transmits a file, each byte b of the file is
  1069. translated according to the following table:
  1070.  
  1071.        0 <= b <=  037: 0172, b + 0100 (0100 to 0137)
  1072.      040 <= b <= 0171:       b        ( 040 to 0171)
  1073.     0172 <= b <= 0177: 0173, b - 0100 ( 072 to  077)
  1074.     0200 <= b <= 0237: 0174, b - 0100 (0100 to 0137)
  1075.     0240 <= b <= 0371: 0175, b - 0200 ( 040 to 0171)
  1076.     0372 <= b <= 0377: 0176, b - 0300 ( 072 to  077)
  1077.  
  1078. That is, a byte between \040 and \171 inclusive is transmitted as is,
  1079. and all other bytes are prefixed and modified as shown.
  1080.  
  1081. When all the file data is sent, a seven byte sequence is sent: two
  1082. bytes of \176 followed by four ASCII bytes of the checksum as printed
  1083. in base 16 followed by a carriage return.  For example, if the
  1084. checksum was 0x1234, this would be sent: "\176\1761234\r".
  1085.  
  1086. The checksum is initialized to 0xffff.  For each byte that is sent it
  1087. is modified as follows (where b is the byte before it has been
  1088. transformed as described above):
  1089.  
  1090.       /* Rotate the checksum left.  */
  1091.       if ((ichk & 0x8000) == 0)
  1092.         ichk <<= 1;
  1093.       else
  1094.         {
  1095.           ichk <<= 1;
  1096.           ++ichk;
  1097.         }
  1098.  
  1099.       /* Add the next byte into the checksum.  */
  1100.       ichk += b;
  1101.  
  1102. When the receiving UUCP sees the checksum, it compares it against its
  1103. own calculated checksum and replies with a single character followed
  1104. by a carriage return.
  1105.     G
  1106.         The file was received correctly.
  1107.     R
  1108.         The checksum did not match, and the file should be resent from
  1109.         the beginning.
  1110.     Q
  1111.         The checksum did not match, but too many retries have occurred
  1112.         and the communication session should be abandoned.
  1113.  
  1114. The sending UUCP checks the returned character and acts accordingly.
  1115.  
  1116. ------------------------------
  1117.  
  1118. From: UUCP-t
  1119. Subject: What is the 't' protocol?
  1120.  
  1121. The 't' protocol is intended for use on links which provide reliable
  1122. end-to-end connections, such as TCP.  It does no error checking or
  1123. flow control, and requires an eight bit clear channel.
  1124.  
  1125. I believe the 't' protocol originated in BSD versions of UUCP.
  1126.  
  1127. When a UUCP package transmits a command, it first gets the length of
  1128. the command string, C.  It then sends ((C / 512) + 1) * 512 bytes (the
  1129. smallest multiple of 512 which can hold C bytes plus a null byte)
  1130. consisting of the command string itself followed by trailing null
  1131. bytes.
  1132.  
  1133. When a UUCP package sends a file, it sends it in blocks.  Each block
  1134. contains at most 1024 bytes of data.  Each block consists of four
  1135. bytes containing the amount of data in binary (most significant byte
  1136. first, the same format as used by the Unix function htonl) followed by
  1137. that amount of data.  The end of the file is signalled by a block
  1138. containing zero bytes of data.
  1139.  
  1140. ------------------------------
  1141.  
  1142. From: UUCP-e
  1143. Subject: What is the 'e' protocol?
  1144.  
  1145. The 'e' protocol is similar to the 't' protocol.  It does no flow
  1146. control or error checking and is intended for use over networks
  1147. providing reliable end-to-end connections, such as TCP.
  1148.  
  1149. The 'e' protocol originated in versions of HDB UUCP.
  1150.  
  1151. When a UUCP package transmits a command, it simply sends the command
  1152. as an ASCII string terminated by a null byte.
  1153.  
  1154. When a UUCP package transmits a file, it sends the complete size of
  1155. the file as an ASCII decimal number.  The ASCII string is padded out
  1156. to 20 bytes with null bytes (i.e. if the file is 1000 bytes long, it
  1157. sends "1000\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0").  It then sends the
  1158. entire file.
  1159.  
  1160. ------------------------------
  1161.  
  1162. From: UUCP-G
  1163. Subject: What is the 'G' protocol?
  1164.  
  1165. The 'G' protocol is used by SVR4 UUCP.  It is identical to the 'g'
  1166. protocol, except that it is possible to modify the window and packet
  1167. sizes.  The SVR4 implementation of the 'g' protocol reportedly is
  1168. fixed at a packet size of 64 and a window size of 7.  Supposedly SVR4
  1169. chose to implement a new protocol using a new letter to avoid any
  1170. potential incompatibilities when using different packet or window
  1171. sizes.
  1172.  
  1173. Most implementations of the 'g' protocol that accept packets larger
  1174. than 64 bytes will also accept packets smaller than whatever they
  1175. requested in the INITB packet.  The SVR4 'G' implementation is an
  1176. exception; it will only accept packets of precisely the size it
  1177. requests in the INITB packet.
  1178.  
  1179. ------------------------------
  1180.  
  1181. From: UUCP-i
  1182. Subject: What is the 'i' protocol?
  1183.  
  1184. The 'i' protocol was written by Ian Lance Taylor (who also wrote this
  1185. FAQ).  It is used by Taylor UUCP version 1.04.
  1186.  
  1187. It is a sliding window packet protocol, like the 'g' protocol, but it
  1188. supports bidirectional transfers (i.e., file transfers in both
  1189. directions simultaneously).  It requires an eight bit clear
  1190. connection.  Several ideas for the protocol were taken from the paper
  1191. ``A High-Throughput Message Transport System'' by P. Lauder.  I don't
  1192. know where the paper was published, but the author's e-mail address is
  1193. piers@cs.su.oz.au.  The 'i' protocol does not adopt his main idea,
  1194. which is to dispense with windows entirely.  This is because some
  1195. links still do require flow control and, more importantly, because
  1196. using windows sets a limit to the amount of data which the protocol
  1197. must be able to resend upon request.  To reduce the costs of window
  1198. acknowledgements, the protocol uses a large window and only requires
  1199. an ack at the halfway point.
  1200.  
  1201. Each packet starts with a six byte header, optionally followed by data
  1202. bytes with a four byte checksum.  There are currently five defined
  1203. packet types (DATA, SYNC, ACK, NAK, SPOS, CLOSE) which are described
  1204. below.  Although any packet type may include data, any data provided
  1205. with an ACK, NAK or CLOSE packet is ignored.
  1206.  
  1207. Every DATA, SPOS and CLOSE packet has a sequence number.  The sequence
  1208. numbers are independent for each side.  The first packet sent by each
  1209. side is always number 1.  Each packet is numbered one greater than the
  1210. previous packet, modulo 32.
  1211.  
  1212. Every packet has a local channel number and a remote channel number.
  1213. For all packets at least one channel number is zero.  When a UUCP
  1214. command is sent to the remote system, it is assigned a non-zero local
  1215. channel number.  All packets associated with that UUCP command sent by
  1216. the local system are given the selected local channel number.  All
  1217. associated packets sent by the remote system are given the selected
  1218. number as the remote channel number.  This permits each UUCP command
  1219. to be uniquely identified by the channel number on the originating
  1220. system, and therefore each UUCP package can associate all file data
  1221. and UUCP command responses with the appropriate command.  This is a
  1222. requirement for bidirectional UUCP transfers.
  1223.  
  1224. The protocol maintains a single global file position, which starts at
  1225. 0.  For each incoming packet, any associated data is considered to
  1226. occur at the current file position, and the file position is
  1227. incremented by the amount of data contained.  The exception is a
  1228. packet of type SPOS, which is used to change the file position.
  1229. The reason for keeping track of the file position is described below.
  1230.  
  1231. The header is as follows:
  1232.  
  1233.     \007
  1234.     Every packet begins with ^G.
  1235.     (PACKET << 3) + LOCCHAN
  1236.     The five bit packet number combined with the three bit local
  1237.     channel number.  DATA, SPOS and CLOSE packets use the packet
  1238.     sequence number for the PACKET field.  NAK packet types use
  1239.     the PACKET field for the sequence number to be resent.  ACK
  1240.     and SYNC do not use the PACKET field, and generally leave it
  1241.     set to 0.  Packets which are not associated with a UUCP
  1242.     command from the local system use a local channel number of 0.
  1243.     (ACK << 3) + REMCHAN
  1244.     The five bit packet acknowledgement combined with the three
  1245.     bit remote channel number.  The packet acknowledgement is the
  1246.     number of the last packet successfully received; it is used by
  1247.     all packet types.  Packets which are not sent in response to a
  1248.     UUCP command from the remote system use a remote channel
  1249.     number of 0.
  1250.     (TYPE << 5) + (CALLER << 4) + LEN1
  1251.     The three bit packet type combined with the one bit packet
  1252.     direction combined with the upper four bits of the data
  1253.     length.  The packet direction bit is always 1 for packets sent
  1254.     by the calling UUCP, and 0 for packets sent by the called
  1255.     UUCP.  This prevents confusion caused by echoed packets.
  1256.     LEN2
  1257.     The lower eight bits of the data length.  The twelve bits of
  1258.     data length permit packets ranging in size from 0 to 4095
  1259.     bytes.
  1260.     CHECK
  1261.     The exclusive or of the second through fifth bytes of the
  1262.     header.  This provides an additional check that the header is
  1263.     valid.
  1264.  
  1265. If the data length is non-zero, the packet is immediately followed by
  1266. the specified number of data bytes.  The data bytes are followed by a
  1267. four byte CRC 32 checksum, with the most significant byte first.  The
  1268. CRC is calculated over the contents of the data field.
  1269.  
  1270. The defined packet types are as follows:
  1271.  
  1272.     0 (DATA)
  1273.     This is a plain data packet.
  1274.     1 (SYNC)
  1275.     SYNC packets are exchanged when the protocol is initialized,
  1276.     and are described further below.  SYNC packets do not carry
  1277.     sequence numbers (that is, the PACKET field is ignored).
  1278.     2 (ACK)
  1279.     This is an acknowledgement packet.  Since DATA packets also
  1280.     carry packet acknowledgements, ACK packets are only used when
  1281.     one side has no data to send.  ACK packets do not carry
  1282.     sequence numbers.
  1283.     3 (NAK)
  1284.     This is a negative acknowledgement.  This is sent when a
  1285.     packet is received incorrectly, and means that the packet
  1286.     number appearing in the PACKET field must be resent.  NAK
  1287.     packets do not carry sequence numbers (the PACKET field is
  1288.     already used).
  1289.     4 (SPOS)
  1290.     This packet changes the file position.  The packet contains
  1291.     four bytes of data holding the file position, most significant
  1292.     byte first.  The next packet received will be considered to be
  1293.     at the named file position.
  1294.     5 (CLOSE)
  1295.     When the protocol is shut down, each side sends a CLOSE
  1296.     packet.     This packet does have a sequence number, which could
  1297.     be used to ensure that all packets were correctly received
  1298.     (this is not needed by UUCP, however, which uses the higher
  1299.     level H command with an HY response).
  1300.  
  1301. When the protocol starts up, both systems send a SYNC packet.  The
  1302. SYNC packet includes at least three bytes of data.  The first two
  1303. bytes are the maximum packet size the remote system should send, most
  1304. significant byte first.  The third byte is the window size the remote
  1305. system should use.  The remote system may send packets of any size up
  1306. to the maximum.  If there is a fourth byte, it is the number of
  1307. channels the remote system may use (this must be between 1 and 7,
  1308. inclusive).  Additional data bytes may be defined in the future.
  1309.  
  1310. The window size is the number of packets that may be sent before a
  1311. packet is acknowledged.  There is no requirement that every packet be
  1312. acknowledged; any acknowledgement is considered to acknowledge all
  1313. packets through the number given.  In the current implementation, if
  1314. one side has no data to send, it sends an ACK when half the window is
  1315. received.
  1316.  
  1317. Note that the NAK packet corresponds to the unused 'g' protocol SRJ
  1318. packet type, rather than to the RJ packet type.  When a NAK is
  1319. received, only the named packet should be resent, not any subsequent
  1320. packets.
  1321.  
  1322. Note that if both sides have data to send, but a packet is lost, it is
  1323. perfectly reasonable for one side to continue sending packets, all of
  1324. which will acknowledge the last packet correctly received, while the
  1325. system whose packet was lost will be unable to send a new packet
  1326. because the send window will be full.  In this circumstance, neither
  1327. side will time out and one side of the communication will be
  1328. effectively shut down for a while.  Therefore, any system with
  1329. outstanding unacknowledged packets should arrange to time out and
  1330. resend a packet even if data is being received.
  1331.  
  1332. Commands are sent as a sequence of data packets with a non-zero local
  1333. channel number.  The last data packet for a command includes a
  1334. trailing null byte (normally a command will fit in a single data
  1335. packet).  Files are sent as a sequence of data packets ending with one
  1336. of length zero.
  1337.  
  1338. The channel numbers permit a more efficient implementation of the UUCP
  1339. file send command.  Rather than send the command and then wait for the
  1340. SY response before sending the file, the file data is sent beginning
  1341. immediately after the S command is sent.  If an SN response is
  1342. received, the file send is aborted, and a final data packet of length
  1343. zero is sent to indicate that the channel number may be reused.  If an
  1344. SY reponse with a file position indicator is received, the file send
  1345. adjusts to the file position; this is why the protocol maintains a
  1346. global file position.
  1347.  
  1348. Note that the use of channel numbers means that each UUCP system may
  1349. send commands and file data simultaneously.  Moreover, each UUCP
  1350. system may send multiple files at the same time, using the channel
  1351. number to disambiguate the data.  Sending a file before receiving an
  1352. acknowledgement for the previous file helps to eliminate the round
  1353. trip delays inherent in other UUCP protocols.
  1354.  
  1355. ------------------------------
  1356.  
  1357. From: UUCP-j
  1358. Subject: What is the 'j' protocol?
  1359.  
  1360. The 'j' protocol is a variant of the 'i' protocol.  It was also
  1361. written by Ian Lance Taylor, and first appeared in Taylor UUCP version
  1362. 1.04.
  1363.  
  1364. The 'j' protocol is a version of the 'i' protocol designed for
  1365. communication links which intercept a few characters, such as XON or
  1366. XOFF.  It is not efficient to use it on a link which intercepts many
  1367. characters, such as a seven bit link.  The 'j' protocol performs no
  1368. error correction or detection; that is presumed to be the
  1369. responsibility of the 'i' protocol.
  1370.  
  1371. When the 'j' protocol starts up, each system sends a printable ASCII
  1372. string indicating which characters it wants to avoid using.  The
  1373. string begins with the ASCII character '^' (octal 136) and ends with
  1374. the ASCII character '~' (octal 176).  After sending this string, each
  1375. system looks for the corresponding string from the remote system.  The
  1376. strings are composed of escape sequences: \ooo, where o is an octal
  1377. digit.  For example, sending the string ^\021\023~ means that the
  1378. ASCII XON and XOFF characters should be avoided.  The union of the
  1379. characters described in both strings (the string which is sent and the
  1380. string which is received) is the set of characters which must be
  1381. avoided in this conversation.  Avoiding a printable ASCII character
  1382. (octal 040 to octal 176, inclusive) is not permitted.
  1383.  
  1384. After the exchange of characters to avoid, the normal 'i' protocol
  1385. start up is done, and the rest of the conversation uses the normal 'i'
  1386. protocol.  However, each 'i' protocol packet is wrapped to become a
  1387. 'j' protocol packet.
  1388.  
  1389. Each 'j' protocol packet consists of a seven byte header, followed by
  1390. data bytes, followed by index bytes, followed by a one byte trailer.
  1391. The packet header looks like this:
  1392.  
  1393.     ^
  1394.         Every packet begins with the ASCII character '^', octal 136.
  1395.     HIGH
  1396.     LOW
  1397.         These two characters give the total number of bytes in the
  1398.         packet.  Both HIGH and LOW are printable ASCII characters.
  1399.         The length of the packet is (HIGH - 040) * 0100 + (LOW - 040),
  1400.         where 040 <= HIGH < 0177 and 040 <= LOW < 0140.  This permits
  1401.         a length of 6079 bytes, but there is a further restriction on
  1402.         packet size described below.
  1403.     =
  1404.         The ASCII character '=', octal 075.
  1405.     DATA-HIGH
  1406.     DATA-LOW
  1407.     These two characters give the total number of data bytes in
  1408.         the packet.  The encoding is as described for HIGH and LOW.
  1409.         The number of data bytes is the size of the 'i' protocol
  1410.         packet wrapped inside this 'j' protocol packet.
  1411.     @
  1412.     The ASCII character '@', octal 100.
  1413.  
  1414. The header is followed by the number of data bytes given in DATA-HIGH
  1415. and DATA-LOW.  These data bytes are the 'i' protocol packet which is
  1416. being wrapped in the 'j' protocol packet.  However, each character in
  1417. the 'i' protocol packet which the 'j' protocol must avoid is
  1418. transformed into a printable ASCII character (recall that avoiding a
  1419. printable ASCII character is not permitted).  Two index bytes are used
  1420. for each character which must be transformed.
  1421.  
  1422. The index bytes immediately follow the data bytes.  The index bytes
  1423. are created in pairs.  Each pair of index bytes encodes the location
  1424. of a character in the 'i' protocol packet which was transformed to
  1425. become a printable ASCII character.  Each pair of index bytes also
  1426. encodes the precise transformation which was performed.
  1427.  
  1428. When the sender finds a character which must be avoided, it will
  1429. transform it using one or two operations.  If the character is 0200 or
  1430. greater, it will subtract 0200.  If the resulting character is less
  1431. than 020, or is equal to 0177, it will xor by 020.  The result is
  1432. a printable ASCII character.
  1433.  
  1434. The zero based byte index of the character within the 'i' protocol
  1435. packet is determined.  This index is turned into a two byte printable
  1436. ASCII index, INDEX-HIGH and INDEX-LOW, such that the index is
  1437. (INDEX-HIGH - 040) * 040 + (INDEX-LOW - 040).  INDEX-LOW is restricted
  1438. such that 040 <= INDEX-LOW < 0100.  INDEX-HIGH is not permitted to be
  1439. 0176, so 040 <= INDEX-HIGH < 0176.  INDEX-LOW is then modified to
  1440. encode the transformation:
  1441.  
  1442.     If the character transformation only had to subtract 0200, then
  1443.     INDEX-LOW is used as is.
  1444.  
  1445.     If the character transformation only had to xor by 020, then 040
  1446.     is added to INDEX-LOW.
  1447.  
  1448.     If both operations had to be performed, then 0100 is added to
  1449.     INDEX-LOW.  However, if the value of INDEX-LOW were initially 077,
  1450.     then adding 0100 would result in 0177, which is not a printable
  1451.     ASCII character.  For that special case, INDEX-HIGH is set to
  1452.     0176, and INDEX-LOW is set to the original value of INDEX-HIGH.
  1453.  
  1454. The receiver decodes the index bytes as follows (this is the reverse
  1455. of the operations performed by the sender, presented here for
  1456. additional clarity):
  1457.  
  1458.     The first byte in the index is INDEX-HIGH, and the second is
  1459.     INDEX-LOW.
  1460.  
  1461.     If 040 <= INDEX-HIGH < 0176, the index refers to the data byte at
  1462.     position (INDEX-HIGH - 040) * 040 + INDEX-LOW % 040.
  1463.  
  1464.         If 040 <= INDEX-LOW < 0100, then 0200 must be added to indexed
  1465.         byte.
  1466.  
  1467.         If 0100 <= INDEX-LOW < 0140, then 020 must be xor'ed to the
  1468.         indexed byte.
  1469.  
  1470.         If 0140 <= INDEX-LOW < 0177, then 0200 must be added to the
  1471.         indexed byte, and 020 must be xor'ed to the indexed byte.
  1472.  
  1473.     If INDEX-HIGH == 0176, the index refers to the data byte at
  1474.     position (INDEX-LOW - 040) * 040 + 037.  0200 must be added to the
  1475.     indexed byte, and 020 must be xor'ed to the indexed byte.
  1476.  
  1477. This means the largest 'i' protocol packet which may be wrapped inside
  1478. a 'j' protocol packet is (0175 - 040) * 040 + (077 - 040) == 3007
  1479. bytes.
  1480.  
  1481. The final character in a 'j' protocol packet, following the index
  1482. bytes, is the ASCII character '~' (octal 176).
  1483.  
  1484. The motivation behind using an indexing scheme, rather than escape
  1485. characters, is to avoid data movement.  The sender may simply add a
  1486. header and a trailer to the 'i' protocol packet.  Once the receiver
  1487. has loaded the 'j' protocol packet, it may scan the index bytes,
  1488. transforming the data bytes, and then pass the data bytes directly on
  1489. to the 'i' protocol routine.
  1490.  
  1491. ------------------------------
  1492.  
  1493. From: UUCP-x
  1494. Subject: What is the 'x' protocol?
  1495.  
  1496. The 'x' protocol is used in Europe (and probably elsewhere) with
  1497. machines that contain an builtin X.25 card and can send eight bit data
  1498. transparently across X.25 circuits, without interference from the X.28
  1499. or X.29 layers.  The protocol sends packets of 512 bytes, and relies
  1500. on a write of zero bytes being read as zero bytes without stopping
  1501. communication.  It first appeared in the original System V UUCP
  1502. implementation.
  1503.  
  1504. ------------------------------
  1505.  
  1506. From: UUCP-y
  1507. Subject: What is the 'y' protocol?
  1508.  
  1509. The 'y' protocol was developed by Jorge Cwik for use in FX UUCICO, a
  1510. PC uucico program.  It is designed for communication lines which
  1511. handle error correction and flow control.  It is a streaming protocol,
  1512. like the 'f' protocol.  It requires an eight bit clean connection.  It
  1513. performs error detection, but not error correction; when an error is
  1514. detected, the line is dropped.  I do not know the implementation
  1515. details.
  1516.  
  1517. ------------------------------
  1518.  
  1519. From: UUCP-d
  1520. Subject: What is the 'd' protocol?
  1521.  
  1522. This is apparently used for DataKit muxhost (not RS-232) connections.
  1523. No file size is sent.  When a file has been completely transferred, a
  1524. write of zero bytes is done; this must be read as zero bytes on the
  1525. other end.
  1526.  
  1527. ------------------------------
  1528.  
  1529. From: UUCP-h
  1530. Subject: What is the 'h' protocol?
  1531.  
  1532. This is apparently used in some places with HST modems.  It does no
  1533. error checking, and is not that different from the 't' protocol.  I
  1534. don't know the details.
  1535.  
  1536. ------------------------------
  1537.  
  1538. From: UUCP-v
  1539. Subject: What is the 'v' protocol?
  1540.  
  1541. The 'v' protocol is used by UUPC/extended, a PC UUCP program.  It is
  1542. simply a version of the 'g' protocol which supports packets of any
  1543. size, and also supports sending packets of different sizes during the
  1544. same conversation.  There are many 'g' protocol implementations which
  1545. support both, but there are also many which do not.  Using 'v' ensures
  1546. that everything is supported.
  1547.  
  1548. ------------------------------
  1549.  
  1550. From: Thanks
  1551. Subject: Thanks
  1552.  
  1553. Besides the papers and information acknowledged at the top of this
  1554. article, the following people have contributed help, advice,
  1555. suggestions and information:
  1556.     Earle Ake 513-429-6500 <ake@Dayton.SAIC.COM>
  1557.     cambler@nike.calpoly.edu (Christopher J. Ambler)
  1558.     jhc@iscp.bellcore.com (Jonathan Clark)
  1559.     jorge@laser.satlink.net (Jorge Cwik)
  1560.     celit!billd@UCSD.EDU (Bill Davidson)
  1561.     "Drew Derbyshire" <ahd@kew.com>
  1562.     erik@pdnfido.fidonet.org
  1563.     Matthew Farwell <dylan@ibmpcug.co.uk>
  1564.     dgilbert@gamiga.guelphnet.dweomer.org (David Gilbert)
  1565.     kherron@ms.uky.edu (Kenneth Herron)
  1566.     Mike Ipatow <mip@fido.itc.e-burg.su>
  1567.     Romain Kang <romain@pyramid.com>
  1568.     "Jonathan I. Kamens" <jik@GZA.COM>
  1569.     "David J. MacKenzie" <djm@eng.umd.edu>
  1570.     jum@helios.de (Jens-Uwe Mager)
  1571.     peter@xpoint.ruessel.sub.org (Peter Mandrella)
  1572.     david nugent <david@csource.oz.au>
  1573.     Stephen.Page@prg.oxford.ac.uk
  1574.     joey@tessi.UUCP (Joey Pruett)
  1575.     James Revell <revell@uunet.uu.net>
  1576.     Larry Rosenman <ler@lerami.lerctr.org>
  1577.     Rich Salz <rsalz@bbn.com>
  1578.     evesg@etlrips.etl.go.jp (Gjoen Stein)
  1579.     kls@ditka.Chicago.COM (Karl Swartz)
  1580.     Dima Volodin <dvv@hq.demos.su>
  1581.     jon@console.ais.org (Jon Zeeff)
  1582.     Eric Ziegast <ziegast@uunet.uu.net>
  1583.  
  1584. ------------------------------
  1585.  
  1586. End of UUCP Internals Frequently Asked Questions
  1587. ******************************
  1588. -- 
  1589. Ian Taylor | ian@airs.com | First to identify quote wins free e-mail message:
  1590. ``You don't have to sleep.  That's just something *they* tell you to keep
  1591.   *control* over you.  Nobody has to sleep; you're *taught* to sleep when
  1592.   you're a kid.  If you're really determined, you can get over it.''
  1593.  
  1594.